function changePage(start, page, display) {
    $.ajax({
        type: "GET",
        url: "getdata.php",
        data: "start=" + start + "&page=" + page + "&display=" + display,
        dataType: 'json',
        cache: false,
        success: function (result) {
            var stringData = "";
            for (var i in result) {
                stringData += result[i];
            }
            $('#user_info > tbody').html(stringData);

            if (page > 1) {
                var next = start + display;
                var prev = start - display;
                var current = (start / display) + 1;
                var stringNav = "";
                if (current != 1) {
                    stringNav += "<li><a href='javascript:changePage(" + prev + "," + page + "," + display + ");'>Previous</a></li>";
                }

                for (var i = 1; i <= page; i++) {
                    if (current != i) {
                        stringNav += "<li><a href='javascript:changePage(" + display * (i - 1) + "," + page + "," + display + ");'>" + i + "</a></li>";
                    } else {
                        stringNav += "<li class='current'>" + i + "</li>";
                    }
                }

                if (current != page) {
                    stringNav += "<li><a href='javascript:changePage(" + next + "," + page + "," + display + ");'>Next</a></li>";
                }
            }
            $('ul.nav').html(stringNav);
        }
    })
}

//if ($page > 1) {
//    $next = $start + $display;
//    $prev = $start - $display;
//    $current = ($start / $display) + 1;
//
////            if ($current != 1) {
////                echo "<li><a href='index.php?start=$prev&page=$page'>Previous</a></li>";
////            }
//    if ($current != 1) {
//        echo "<li><a href='changePage($prev,$page);'>Previous</a></li>";
//    }
//
//    for ($i = 1; $i <= $page; $i++) {
//        if ($current != $i) {
//            //echo "<li><a href='index.php?start=" . $display * ($i - 1) . "&page=$page'>$i</a></li>";
//            echo "<li><a href='changePage(".$display * ($i - 1).",$page);'>$i</a></li>";
//        } else {
//            echo "<li class='current'>$i</li>";
//        }
//    }
////            if ($current != $page) {
////                echo "<li><a href='index.php?start=$next&page=$page'>Next</a></li>";
////            }
//
//    if ($current != 1) {
//        echo "<li><a href='changePage($next,$page);'>Next</a></li>";
//    }
//}


